/*
 *  Copyright (C) 2011 Sitem Cartografia SLU
 */
 package com.sitem.appsjam;


import java.util.ArrayList;

import android.app.ListActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.ListView;

import com.sitem.appsjam.LayerCheckBoxListAdapter.LayerCheckBoxView;
import com.sitem.appsjam.Managers.LayerManager;
import com.sitem.appsjam.Types.Layer;

public class ARLayerControl extends ListActivity {
	
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.control_capes);
        ArrayList<Layer> list = LayerManager.getAllLayers();
        LayerCheckBoxListAdapter mListAdapter = new LayerCheckBoxListAdapter(this, list);
        setListAdapter(mListAdapter);
    }
    
    @Override
	protected void onListItemClick(ListView l, View v, int position, long id) {
		// Canvia l'estat del check
		if ( v != null ) {
			LayerCheckBoxView CurrentView = (LayerCheckBoxView)v;
			if ( CurrentView != null )CurrentView.toggleCheckBoxState();
		}
		super.onListItemClick(l, v, position, id);
	}
}
